package com.heaven.back.controller;

import com.heaven.back.pojo.Player;
import com.heaven.back.pojo.Result;
import com.heaven.back.service.ActionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * The type Register conroller.
 */
@Slf4j
@RestController
@CrossOrigin(origins = "*")
public class RegisterConroller {

    @Autowired
    private ActionService actionService;

    /**
     * Login result.
     *
     * @param p the p
     * @return the result
     */
    @PostMapping("/register")
    public Result login(@RequestBody Player p){
        log.info("玩家注册:{}",p);
        //先查找
        actionService.add(p);
        return Result.success();
    }

}
